using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "HOANCANHKINHTE", Schema="dbo")]
	[Table(Name = "[dbo].[HOANCANHKINHTE]")]
	public partial class HOANCANHKINHTE : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _mahoancanhkinhte;

		private System.String _tenhoancanhkinhte;

		private System.Int32? _priority;

		private IEnumerable<HOGIADINH> _ref_hogiadinh;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MAHOANCANHKINHTE", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MAHOANCANHKINHTE
		{
			get
			{
				return _mahoancanhkinhte;
			}
			set
			{
				OnChanged(this, "MAHOANCANHKINHTE");
				_mahoancanhkinhte = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENHOANCANHKINHTE", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENHOANCANHKINHTE
		{
			get
			{
				return _tenhoancanhkinhte;
			}
			set
			{
				OnChanged(this, "TENHOANCANHKINHTE");
				_tenhoancanhkinhte = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "PRIORITY", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? PRIORITY
		{
			get
			{
				return _priority;
			}
			set
			{
				OnChanged(this, "PRIORITY");
				_priority = value;
			}
		}

		public IEnumerable<HOGIADINH> REF_HOGIADINH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_hogiadinh == null))
					InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH>.Select(this, "REF_HOGIADINH", new[] { new Vector<string, string>("MAHOANCANHKINHTE", "MAHOANCANHKINHTE"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_hogiadinh;
			}
			set
			{
				_ref_hogiadinh = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(HOANCANHKINHTE);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
